import { defHttp } from '/@/utils/http/axios';
import { WebsiteParams, WebsiteListGetResultModel } from './websiteModel';

enum Api {
  List = '/company/pageCompanyWebsite',
  SaveOrUpdate = '/company/saveOrUpdateCompanyWebsite',
  DetailById = '/company/detailWebsiteById',
  DetailByCompanyId = '/company/detailWebsiteByCompanyId',
  Delete = '/company/deleteCompanyWebsite',
}

// 请求接口

export const getList = (params?: WebsiteParams) =>
  defHttp.get<WebsiteListGetResultModel>({ url: Api.List, params });

export const saveOrUpdate = (params?: WebsiteParams) =>
  defHttp.post({ url: Api.SaveOrUpdate, params}, { errorMessageMode: 'modal' });

export const detailById = (id: number) =>
  defHttp.get({ url: Api.DetailById + `/${id}` });

export const detailByCompanyId = () =>
  defHttp.get({ url: Api.DetailByCompanyId });

export const delById = (id: number) =>
  defHttp.get({ url: Api.Delete + `/${id}` });
